/*
 * json处理
 * 版本：1.0
 */
define(function(require, exports, module) {
	/*获得一个随机数
	 num_:随机数的位数
	 prefix_:随机数前面是否加前缀
	 * */
	exports.random = function() {
		var prefix = '';
		/*最终需要随机的字符串*/
		var randomRoot = '';
		return {
			val: function(num_) {

				if (randomRoot == '') randomRoot = "0123456789";
				var len = randomRoot.length;
				var Num = '';
				for (var i = 0; i < num_; i++) {
					Num += randomRoot[Math.floor(Math.random() * len)];
				}
				return prefix + Num+'';
			},

			/*设置随机数需要的类型
			 * number_:boolean数字型
			 * az_:boolean小写字母
			 * AZ_：boolean大写字母
			 */
			type: function(number_, az_, AZ_) {
				if (number_) randomRoot += "0123456789";
				if (az_) randomRoot += "abcdefghijklmnopqrstuvwxyz";
				if (number_) randomRoot += "ABCDEFGHIJKLMNOPQRSTUVWSYZ";
				return this;
			},

			/*设置前缀*/
			prefix: function(prefix_) {
				prefix = prefix_;
				return this;
			}
		}
	};

	window.yun_string = exports;
});